#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

int main(int argc, char **argv)
{
	int fd=0;
	int i=0;
	unsigned char TM1638_LED[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F,0x77,0x7C,0x39,0x5E,0x79,0x71}; //0～F，1亮0灭
	unsigned char TM1638_LED_P[]={0xBF,0x86,0xDB,0xCF,0xE6,0xED,0xFD,0x87,0xFF,0xEF,0xF7,0xFC,0xB9,0xDE,0xF9,0xF1}; //0～F，1亮0灭

	if(argc!=2)
	{
		printf("Usage error:%s\r\n",argv[0]);
		return -1;
	}

	fd = open(argv[1],O_RDWR);
	if(fd <0)
	{
		printf("open %s error\r\n",argv[1]);
		return -1;
	}

	while(1)
	{
		write(fd, &TM1638_LED_P[i++], 9);
		if(i>7) i=0;
		sleep(1);
	}

	close(fd);
	return 0;
}


